<?php
/**
 * Created by JetBrains PhpStorm.
 * User: ZHOUYANG
 * Date: 13-3-30
 * Time: 下午2:37
 */
 
class IndexController extends Controller{

    public function index(){
        $user_info = Model::getInstance('user')->getUserById($this->session()->get('user_id'));

        $menu_arr = Model::getInstance('cate')->getTree();

        $user_roles = Model::getInstance('user')->getUserRoles($user_info['user_id']);

        $user_cate_ids = Model::getInstance('user')->getUserCateIds($user_info['user_id']);
        $data = array(
            'user_info'=>$user_info,
            'user_roles'=>$user_roles,
            'menu_arr'=>$menu_arr,
            'user_cate_ids'=>$user_cate_ids,
        );

        $template = array('data'=>$data);
        Template::show($template);
    }

    public function main(){
        $user_info = Model::getInstance('user')->getUserById($this->session()->get('user_id'));

        $data = array(
            'user_info'=>$user_info
        );

        $template = array('data'=>$data,'view'=>'main.php');
        Template::show($template);

    }
}